package example.com.zcq.mymj.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import example.com.zcq.mymj.R;
import example.com.zcq.mymj.bean.JiaoZhao;
import example.com.zcq.mymj.ui.TopBar;

public class JiazhaoActivity extends AppCompatActivity {

    private TopBar mTopbarTitle;
    /**
     * 问题：下俩争取得分
     */
    private TextView mTvWenti;
    /**
     * a....
     */
    private TextView mTvXx1;
    /**
     * b...
     */
    private TextView mTvXx2;
    /**
     * c....
     */
    private TextView mTvXx3;
    /**
     * d....
     */
    private TextView mTvXx4;
    /**
     * 答案。。。
     */
    private TextView mTvDaan;
    /**
     * 提示：。。。
     */
    private TextView mTvTip;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jiazhao);
        initView();
        initData();
    }

    private void initData() {
        Intent intent = getIntent();
        JiaoZhao.ResultBean d = (JiaoZhao.ResultBean) intent.getSerializableExtra("bean");
        if (d != null) {
            mTvWenti.setText("问题：" + d.getQuestion());
            mTvXx1.setText("A." + d.getItem1());
            mTvXx2.setText("B." + d.getItem2());
            mTvXx3.setText("C." + d.getItem3());
            mTvXx4.setText("D." + d.getItem4());
            switch (d.getAnswer()) {
                case "1":
                    mTvDaan.setText("正确答案：A");

                    break;
                case "2":
                    mTvDaan.setText("正确答案：B");

                    break;
                case "3":
                    mTvDaan.setText("正确答案：C");

                    break;
                case "4":
                    mTvDaan.setText("正确答案：D");
                    break;
                default:
                    break;
            }

            mTvTip.setText("提示："+d.getExplains());
        }


    }

    private void initView() {
        mTopbarTitle = (TopBar) findViewById(R.id.topbar_title);
        mTvWenti = (TextView) findViewById(R.id.tv_wenti);
        mTvXx1 = (TextView) findViewById(R.id.tv_xx1);
        mTvXx2 = (TextView) findViewById(R.id.tv_xx2);
        mTvXx3 = (TextView) findViewById(R.id.tv_xx3);
        mTvXx4 = (TextView) findViewById(R.id.tv_xx4);
        mTvDaan = (TextView) findViewById(R.id.tv_daan);
        mTvTip = (TextView) findViewById(R.id.tv_tip);
    }
}
